package gghotline

import (
	"wzgames/internal/secure"
	"wzgames/internal/services/games"
	"wzgames/pkg/utils/byteutil"
)

type GMarker struct {
	games.Marker

	serverSeed string
	nextSeed   string
}

func NewGMarker() games.IMarkerService {
	m := &GMarker{}
	return m
}

func (mk *GMarker) InitServerSeed(serverSeed, nextServerSeed string) {
	mk.serverSeed = serverSeed
	mk.nextSeed = nextServerSeed
}

func (mk *GMarker) NextServerSeed256() string {
	return secure.Sha256Hex(byteutil.StringToSliceByte(mk.nextSeed))
}

func (mk *GMarker) RefreshSeed(nextServerSeed string) {
	mk.serverSeed = mk.nextSeed
	mk.nextSeed = nextServerSeed
}

func (mk *GMarker) ServerSeed() string {
	return mk.serverSeed
}
